package com.team2.outpatient_sys.dao;

import com.team2.outpatient_sys.pojo.Prescription;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import com.team2.outpatient_sys.pojo.PrescriptionAndName;


@Mapper
public interface PrescriptionDao {

    @Insert("insert into prescription values(null,#{patientId},#{doctorId})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    public int add(Prescription prescription);

    @Select("select * from prescription")
    public List<Prescription> findAllPrescription();

    @Select("SELECT * From `prescription`")
    List<PrescriptionAndName> getAndPatientDoctorName();
}
